<?php
$name=$_GET['name'];
$pwd=$_GET['pwd'];

$conn = mysqli_connect('localhost', 'root', 'root', '2008');
mysqli_query($conn, "set charset 'utf8'");
mysqli_query($conn, "set character set 'utf8'");
// $sql="select * from users where name='$name' and pwd='$pwd'"
$sql = "select * from users where name='$name' and pwd='$pwd'";

$res=mysqli_query($conn,$sql);
$count=mysqli_num_rows($res);
if($count>0){
    echo json_encode(array(
        "code"=>200,
        "body"=>array(
            "msg"=>"登录成功"
        )
        ));
}else{
    echo json_encode(array(
        "code"=>201,
        "body"=>array(
            "msg"=>"登录失败，请重试"
        )
        ));
}
?>